<?php
    class product_follow_Controller extends controllerBase
    {
        public function process()
        {
            $sfamilyname ='';
            $aproducts = array();
            $this->aParams['notfound']='';
            $oDatabase = new database(); 
            core::checkSession();
            if(isset($_SESSION['user_uri']))
            {
                $uriUser = $_SESSION['user_uri'];
                $querylistProduct = 'PREFIX foaf: <http://xmlns.com/foaf/0.1/>
                PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                PREFIX dc: <http://purl.org/dc/elements/1.1/>
                PREFIX bus: <'.URL::getLink('id/bussiness#').'>

                SELECT * 
                WHERE
                {
                ?uriper rdf:type foaf:Person.
                ?uriper bus:followProduct ?uri.
                ?uri bus:name ?name.
                OPTIONAL {?uri bus:ownUser ?user.
                ?user foaf:familyName ?ownUser.}.
                ?uri bus:image ?image.
                ?uri bus:price ?price.
                ?uri bus:description ?description.
                FILTER(?uriper = "'.$uriUser.'").
                }';
                $aListProducts = $oDatabase->loadQuery($querylistProduct);
                if(count($aListProducts['result']['rows'])!=0)
                {   
                    $aproducts=$aListProducts['result']['rows'];
                }
                else
                {
                    $this->aParams['notfound']='NO PRODUCT FLOW';
                }
            }
            $this->aParams['alistproducts'] = $aproducts;
            // print_r($aproducts);
        }
    }
?>
